<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html lang="zh-cn">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="<%=path %>/admin/css/pintuer.css">
    <link rel="stylesheet" href="<%=path %>/admin/css/admin.css">
    <link rel="stylesheet" href="<%=path %>/admin/css/style.css">
    <link rel="stylesheet" href="<%=path %>/admin/font-awesome-4.7.0/css/font-awesome.css">
    <script src="<%=path %>/admin/js/jquery.js"></script>
    <script src="<%=path %>/admin/js/pintuer.js"></script>  
    <link rel="stylesheet" href="<%=path %>/static/css/paging.css" />
    <script src="<%=path %>/static/js/paging.js"></script>
<%--     
	<link rel="stylesheet" href="<%=path %>/static/js/picbox/css/picbox.css" />
    <script src="<%=path %>/static/js/picbox/js/jquery.rotate.js"></script>
	<script src="<%=path %>/static/js/picbox/js/picbox.js"></script> --%>
		
</head>
<body>
<form method="get" action="<%=path %>/bUserInfo/list" id="listform">

	<input type="hidden" id="totalSize" name="totalSize" value="${totalSize }">
	<input type="hidden" id="pageNo" name="pageNo" value="${pageNo}">
	<input type="hidden" id="authInfo" name="authInfo" value="1">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder">认证审核列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <!--<li> <a class="button border-main icon-plus-square-o" href="add.html"> 添加内容</a> </li>-->
       <!-- <li>搜索：</li>-->
        <li style='width:60%'>
          	<input type="text" id="name" name="name" placeholder="姓名" class="input" style="width:150px; line-height:17px;display:inline-block" value="${name}" />
          	<input type="text"  id="phone" name="phone" placeholder="手机号" class="input" style="width:150px; line-height:17px;display:inline-block" value="${phone}" />
	       <select id="authenticationType" name="authenticationType" class="input"  style="width:18%; line-height:17px;display:inline-block;height:39px;padding:0 10px">
	           <option value="">认证类型</option>
	           <option value="企业">企业</option>
	           <option value="个人">个人</option>
	       </select>
	       <select id="attestationStatus" name="attestationStatus" class="input"  style="width:18%; line-height:17px;display:inline-block;height:39px;padding:0 10px">
            <option value="10">认证状态</option>
            <option value="1">待审核</option>
            <option value="2">驳回</option>
            <option value="3">认证通过</option>
          </select>
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a>
        </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr class="thead">
        <th style="text-align:left; padding-left:20px;width:5%">序号</th>
        <th style="width:10%">姓名</th>
        <th style="width:10%">手机号</th>
        <th style="width:10%">认证类型</th>
        <th style="width:10%">审核状态</th>
        <th style="width:10%">认证申请时间</th>
        <th width="10%">操作</th>
      </tr>
      <volist name="list" id="vo">
      <c:forEach items="${List}" var="item" varStatus="vs">  
          	<tr class="fir">
			 <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="" />
                ${vs.count+pageInfo.startIndex+(pageNo-1)*15}
            </td>
            <td>${item.name}</td>
            <td>${item.phone}</td>
            <td>${item.authenticationType}</td>
            <td>
             <c:choose>
                   <c:when test="${item.attestationStatus==1}">待审核</c:when>
                   <c:when test="${item.attestationStatus==2}">驳回</c:when>
                   <c:when test="${item.attestationStatus==3}">认证通过</c:when>
               </c:choose>
            </td>
            <td>
				<fmt:formatDate value="${item.applyTime}" pattern="yyyy-MM-dd HH:mm:ss" />
			</td>
			<td>
				<div class="suspended-pos"><i class="fa fa-exclamation-circle" onclick="look('${item.openid}')"></i><span class="suspended">查看</span></div> 
			</td>
       
		</tr>            
	 </c:forEach>
     <c:if test="${empty List}">
		<tr>
        	<td colspan="5" class="t_c">
                <span class="no-records">暂无数据</span>
            </td>
        </tr>
      </c:if>
      <c:if test="${!empty List}">
	  <!--  <tr>
	        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>全选 </td>
	        <td colspan="7" style="text-align:left;padding-left:20px;">
		        <a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> 
	        </td>
	    </tr>  -->
	      <tr>
	        <td colspan="8">
	        	<div id="page" class="page_div"></div>
	        </td>
	      </tr>
	   </c:if>  
    </table>
  </div>
</form>
<script type="text/javascript">

var pageNo = Number($("#pageNo").val());
var totalSize = Number($("#totalSize").val());
var totalPage = Number(Math.ceil(totalSize/15));
//分页
$("#page").paging({
	pageNo:pageNo,//当前页
	totalPage: totalPage,//总页数
	totalSize: totalSize,//总条数
	callback: function(num) {
		newPage(num);
	}
})

function look(id){ 
	window.location.href="<%=path %>/bUserInfo/view?openid="+id;
	
}

//搜索
function changesearch(){	
	newPage(1);
}

function newPage(pageNo){
    var params = new Object();
    params.pageNo = pageNo;
    params.name=$("#name").val().trim();
    params.phone=$("#phone").val().trim();
    params.authInfo=$("#authInfo").val();
    params.attestationStatus=$('#attestationStatus option:selected').val();
    params.authenticationType=$('#authenticationType option:selected').val();
    $.ajax({ 
        type:"post",
        url:"<%=path %>/bUserInfo/newPage.html",
        data:params,
        dataType: "json",  
        timeout: 10000,  
        cache: false,  
        error: function(){
            alert("系统忙...");
        },
        success: function(data){
            var json=eval(data);
            pageNo = json.pageNo;
            pageSum = json.pageSum;
            count = json.count;
            var htmls = "";
         $.each(json.platfromList, function (index, item) {
              var xu=(pageNo-1)*15+index+1;
               htmls+='<tr class="fir">'
                    +'<td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="" />'+xu+'</td>'
                    +'<td>'+item.name+'</td>'
                    +'<td>'+item.phone+'</td>'
                    +'<td>'+item.authenticationType+'</td>'
                  if(item.attestationStatus==1){
                	  htmls+='<td>待审核</td>'
                  }else if(item.attestationStatus==2){
                	  htmls+='<td>驳回</td>'
                  }else{
                	  htmls+='<td>认证通过</td>' 
                  }
                    htmls+='<td>'+getNowFormatDate(item.applyTime)+'</td>';
                   
                htmls+='<td><div class="suspended-pos"><i class="fa fa-exclamation-circle" onclick="look(\''+item.openid+'\')"></i><span class="suspended">查看</span></div></div>';
                htmls+='</td></tr>';
         });
         $(".fir").remove();
         $(".thead").after(htmls);
         if(htmls==""){
             $("#page").html("");
         }else{
             $("#page").html("");
             $("#page").paging({
                 pageNo:pageNo,//当前页
                 totalPage: pageSum,//总页数
                 totalSize: count,//总条数
                 callback: function(num) {
                     newPage(num); 
                }
             }) 
          }
        }   
    });
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

function getNowFormatDate(time) {
    var date = new Date(time);
    var seperator1 = "-";
    var seperator2 = ":";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var h = 0;
    if (date.getHours() >= 0 && date.getHours() <= 9) {
        h = "0" + date.getHours();
    }else{
        h = date.getHours();
    }
    var m = 0;
    if (date.getMinutes() >= 0 && date.getMinutes() <= 9) {
        m = "0" + date.getMinutes();
    }else{
        m = date.getMinutes();
    }
    var s = 0;
    if (date.getSeconds() >= 0 && date.getSeconds() <= 9) {
        s = "0" + date.getSeconds();
    }else{
        s = date.getSeconds();
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate
            + " " + h + seperator2 + m
            + seperator2 + s;
    return currentdate;
}

</script>
</body>
</html>